﻿using System;
using System.Collections.Generic;
using System.Text;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.DAL;
using System.Data;
using HZ.Common;
using System.Collections;
namespace HZ.DrugTrade.BLL
{
  public  class BLL_HospitalLoginPriceGoods:IBLL_HospitalLoginPriceGoods
    {
      /// <summary>
      /// 获得医疗机构款填信息列表
      /// </summary>
      /// <param name="where"></param>
      /// <param name="currentPage"></param>
      /// <param name="pagesize"></param>
      /// <param name="totalrecord"></param>
      /// <returns></returns>
      public IList<HZ.DrugTrade.Model.View.HospitalLoginPriceGoods> GetHospitalLoginPriceGoods(HZ.DrugTrade.Model.Query.HospitalLoginPriceGoods where, int currentPage, int pagesize, out int totalrecord)
      {
             BLL_UserSession.CheckSession();
          return DAL_HospitalLoginPriceGoods.GetHospitalLoginPriceGoods(where, currentPage, pagesize, out totalrecord);
      }
      /// <summary>
      /// 
      /// </summary>
      /// <param name="where"></param>
      /// <param name="currentPage"></param>
      /// <param name="pagesize"></param>
      /// <param name="totalrecord"></param>
      /// <returns></returns>
        public IList<HZ.DrugTrade.Model.View.HospitalLoginPriceGoods> GetGoodsByWhere(HZ.DrugTrade.Model.Query.HospitalLoginPriceGoods where, int currentPage, int pagesize, out int totalrecord)
       {
        //   BLL_UserSession.CheckSession();
           return DAL_HospitalLoginPriceGoods.GetGoodsByWhere(where, currentPage, pagesize, out totalrecord);
        }
        public IList<HZ.DrugTrade.Model.View.HospitalLoginPriceGoods> getGoodsToTalByWhere(HZ.DrugTrade.Model.Query.HospitalLoginPriceGoods where, int currentpage, int pagesize, out int totalrecord)
        {
            BLL_UserSession.CheckSession();
            return DAL_HospitalLoginPriceGoods.getGoodsToTalByWhere(where, currentpage, pagesize, out totalrecord);
        }
          public int UpdateGoodsLoginPrice(Model.View.HospitalLoginPriceGoods where)
        {
            BLL_UserSession.CheckSession();
            return DAL_HospitalLoginPriceGoods.UpdateGoodsLoginPrice(where);
        }
      /// <summary>
      /// 开启县级以上填报开关
      /// </summary>
      /// <returns></returns>
          public bool OpenCountryOver()
          {
              BLL_UserSession.CheckSession();
              bool result =DAL_HospitalLoginPriceGoods.OpenCountryOver();
              if(result){
                  BLL_Log.Instance.AddKeyOperationLog(new KeyOperationLog() { OperateMessage = string.Format("开启县级以上填报开关") }); 
              }
              return result;
          }
          /// <summary>
          ///关闭县级以上填报开关
          /// </summary>
          /// <returns></returns>
          public bool CloseCountryOver()
          {
              BLL_UserSession.CheckSession();
              bool result = DAL_HospitalLoginPriceGoods.CloseCountryOver();
              if (result)
              {
                  BLL_Log.Instance.AddKeyOperationLog(new KeyOperationLog() { OperateMessage = string.Format("关闭县级以上填报开关") });
              }
              return result;

          }
          public int CalHospitalLoginPrice()
          {
              return DAL_HospitalLoginPriceGoods.CalHospitalLoginPrice();
          }
      /// <summary>
      /// 删除确定了的价格和购买数量
      /// </summary>
      /// <param name="HospitalID"></param>
      /// <param name="GoodsID"></param>
      /// <returns></returns>
          public int DeletePriceCount(string HospitalID, int GoodsID)
          {
              int state = DAL_HospitalLoginPriceGoods.DeletePriceCount(HospitalID, GoodsID);
              if(state == 1)
              {
                  BLL_Log.Instance.AddKeyOperationLog(new KeyOperationLog { OperateMessage = string.Format("删除确定了的价格和购买数量：{0};处理时间:{1};)", GoodsID, DateTime.Now.ToString()), ClientIP = HZ.Fun2.GetClientIP() });
              }
              return state; 
          }
    }
}
